package com.czmc.smalldemo.app.main;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;

import net.wequick.small.Small;

public class MainActivity extends Activity {
    static {
        System.loadLibrary("native-lib");
    }

    private SimpleDraweeView im_test;
    private TextView tv_1;

    public native String stringFromJNI();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        im_test = (SimpleDraweeView)  findViewById(R.id.im_test);
        tv_1 = (TextView)  findViewById(R.id.tv_1);
        tv_1.setText(stringFromJNI());
        im_test.setImageURI(Uri.parse("http://hardy-01.imwork.net/upload//images/20170104/1483500698393.png"));

    }
    public void openHost(View view){
        Intent intent = new Intent();
        intent.setClassName(this,"com.czmc.smalldemo.SecondActivity");
        startActivity(intent);
    }
    public void test(View view){
//        new Utils() {
//            @Override
//            public void onDownLoadFinish() {
//                runOnUiThread(new Runnable() {
//                    @Override
//                    public void run() {
////                            Small.getBundleVersions();
//////                            if (!Small.updateManifest(new JSONObject(getFromAssets("bundle.json")), false)) {
//////                                Toast.makeText(LaunchActivity.this,"失败",Toast.LENGTH_SHORT).show();
//////                                return;
////                            }
//                        Small.setBundleUpgraded("com.czmc.smalldemo.app.main",true);
//                        Small.getBundle("com.czmc.smalldemo.app.main").upgrade();
//                        Toast.makeText(MainActivity.this,"更新完成！",Toast.LENGTH_SHORT).show();
//
//                    }
//                });
//
//
//            }
//        }.doDownload("http://192.168.0.103:8080/test/file/libcom_czmc_smalldemo_app_main.so", Small.getBundle("com.czmc.smalldemo.app.main").getPatchFile());
//
    }

}
